Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Nuke: Build workfile by template #3544

Closed
wants to merge 15 commits into from
Closed

Nuke: Build workfile by template #3544

wants to merge 15 commits into from

Conversation

friquette
Copy link
Contributor

@friquette friquette commented Jul 20, 2022

Brief description

Following discussion https://github.com/pypeclub/OpenPype/discussions/2013
This PR depends on the Maya build workfile by template #3315

Templated Build Workfile

Building a workfile using a template designed by users. Helping to assert homogeneous subsets hierarchy and imports. Template stored as file easy to define, change and customize for production needs.

1. Make a template

Make your template. Add nodes and everything needed for your tasks. Here is an example template for the compositing task using a placeholder.

image

The placeholder will be replaced by the nodes you want. To create a placeholder: OpenPype > Template Builder > Create Place Holder

image

  • Configure placeholders

Fill in the necessary fields (the optional fields are regex filters)

image

- Builder type: Wether the the placeholder should load current asset representations or linked assets representations

- Representation: Representation that will be loaded (ex: ma, abc, png, etc...)

- Family: Family of the representation to load (main, look, image, etc ...)

- Loader: Placeholder loader name that will be used to load corresponding representations

- Order: Priority for current placeholder loader (priority is lowest first, highet last)
  • Save your template

2. Configure Template

  • Go to Studio settings > Project > Your DCC > Templated Build Settings
  • Add a profile for your task and enter path to your template

image

3. Build your workfile

  • Open Nuke

  • Build your workfile

image

@friquette friquette marked this pull request as ready for review July 20, 2022 16:15
@mkolar
Copy link
Member

mkolar commented Jul 22, 2022

Thank you @friquette! we're actually just about to approve and merge the source PR for Maya, which opens the road this right away. We'll have a look and give it a proper review

@jrsndl
Copy link
Collaborator

jrsndl commented Jul 22, 2022

Thank you @friquette , this is awesome! I was able to make and use template with loadClip for mov and exr.

  • Is there a way to load "look" as input process with LoadEffectsInputProcess? I was not able to make it work.
  • A minor one - looks like the template can't handle connecting loadClip with retime (Timewarp node).
  • The Path to template in settings is accepting root, but it refused {project[name]} or {task[name]}, it would be great to have that flexibility.
  • Applying template adds rogue Y_init knob in the OpenPype tab of the create Read.
    image

Copy link
Member

@m-u-r-p-h-y m-u-r-p-h-y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an error during Nuke startup

  sys.version_info < (3,) and warnings.warn("*" * 60 + msg + "*" * 60)
Traceback (most recent call last):
  File "D:\REPO\OpenPype\openpype\hosts\nuke\startup/menu.py", line 5, in <module>
    from openpype.hosts.nuke import api
  File "D:\REPO\OpenPype\openpype\hosts\nuke\api\__init__.py", line 17, in <module>
    from .plugin import OpenPypeCreator
  File "D:\REPO\OpenPype\openpype\hosts\nuke\api\plugin.py", line 14, in <module>
    from .lib import (
  File "D:\REPO\OpenPype\openpype\hosts\nuke\api\lib.py", line 24, in <module>
    from openpype.tools.utils import host_tools
  File "D:\REPO\OpenPype\openpype\tools\utils\__init__.py", line 1, in <module>
    from .widgets import (
  File "D:\REPO\OpenPype\openpype\tools\utils\widgets.py", line 4, in <module>
    from openpype.vendor.python.common import qargparse
ImportError: No module named python.common

image

Copy link
Member

@m-u-r-p-h-y m-u-r-p-h-y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still no luck for me . . .

image

 sys.version_info < (3,) and warnings.warn("*" * 60 + msg + "*" * 60)
Traceback (most recent call last):
  File "D:\REPO\OpenPype\openpype\hosts\nuke\startup/menu.py", line 3, in <module>
    from openpype.api import Logger
  File "D:\REPO\OpenPype\openpype\api.py", line 1, in <module>
    from .settings import (
  File "D:\REPO\OpenPype\openpype\settings\__init__.py", line 27, in <module>
    from .entities import (
  File "D:\REPO\OpenPype\openpype\settings\entities\__init__.py", line 73, in <module>
    from .base_entity import (
  File "D:\REPO\OpenPype\openpype\settings\entities\base_entity.py", line 18, in <module>
    from openpype.lib import PypeLogger
  File "D:\REPO\OpenPype\openpype\lib\__init__.py", line 54, in <module>
    from .execute import (
  File "D:\REPO\OpenPype\openpype\lib\execute.py", line 8, in <module>
    from .log import PypeLogger as Logger
  File "D:\REPO\OpenPype\openpype\lib\log.py", line 28, in <module>
    from .mongo import (
  File "D:\REPO\OpenPype\openpype\lib\mongo.py", line 5, in <module>
    import pymongo
  File "D:\REPO\OpenPype\.venv\lib\site-packages\pymongo\__init__.py", line 112, in <module>
    from pymongo.collection import ReturnDocument
  File "D:\REPO\OpenPype\.venv\lib\site-packages\pymongo\collection.py", line 29, in <module>
    from pymongo import (common,
  File "D:\REPO\OpenPype\.venv\lib\site-packages\pymongo\common.py", line 36, in <module>
    from pymongo.ssl_support import (validate_cert_reqs,
  File "D:\REPO\OpenPype\.venv\lib\site-packages\pymongo\ssl_support.py", line 36, in <module>
    import certifi
  File "D:\REPO\OpenPype\.venv\lib\site-packages\certifi\__init__.py", line 1, in <module>
    from .core import contents, where
  File "D:\REPO\OpenPype\.venv\lib\site-packages\certifi\core.py", line 17
    def where() -> str:
                ^
SyntaxError: invalid syntax

@friquette
Copy link
Contributor Author

Are you sure your venv is set in python3 ?

@m-u-r-p-h-y
Copy link
Member

think so, . .

image

@@ -0,0 +1,206 @@
from collections import OrderedDict

from openpype.vendor.python.common import qargparse
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from openpype.vendor.python.common import qargparse
import qargparse


from openpype.vendor.python.common import qargparse
from openpype.tools.utils.widgets import OptionDialog
from openpype.hosts.nuke.api.lib import imprint
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from openpype.hosts.nuke.api.lib import imprint
from .lib import imprint

def populate_template(self, ignored_ids=None):
place_holders = self.get_template_nodes()
while len(place_holders) > 0:
super().populate_template(ignored_ids)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
super().populate_template(ignored_ids)
super(NukeTemplateLoader, self).populate_template(ignored_ids)

return ids

def get_placeholders(self):
placeholders = super().get_placeholders()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
placeholders = super().get_placeholders()
placeholders = super(NukeTemplateLoader, self).get_placeholders()

set inputs and outputs of loaded nodes"""

node = self.data['node']
input, output = get_io(self.data['last_loaded'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might be also some single unconnected nodes

Traceback (most recent call last):
  File "C:\CODE\__PYPE\OpenPype\openpype\hosts\nuke\api\pipeline.py", line 223, in <lambda>
    lambda: build_workfile_template()
  File "C:\CODE\__PYPE\OpenPype\openpype\lib\build_template.py", line 28, in build_workfile_template
    template_loader.populate_template()
  File "C:\CODE\__PYPE\OpenPype\openpype\hosts\nuke\api\template_loader.py", line 47, in populate_template
    super(NukeTemplateLoader, self).populate_template(ignored_ids)
  File "C:\CODE\__PYPE\OpenPype\openpype\lib\abstract_template_loader.py", line 254, in populate_template
    self.postload(placeholder)
  File "C:\CODE\__PYPE\OpenPype\openpype\lib\abstract_template_loader.py", line 306, in postload
    placeholder.clean()
  File "C:\CODE\__PYPE\OpenPype\openpype\hosts\nuke\api\template_loader.py", line 447, in clean
    self.set_loaded_connections()
  File "C:\CODE\__PYPE\OpenPype\openpype\hosts\nuke\api\template_loader.py", line 346, in set_loaded_connections
    input, output = get_io(self.data['last_loaded'])
  File "C:\CODE\__PYPE\OpenPype\openpype\hosts\nuke\api\lib.py", line 2628, in get_io
    raise Exception("No Input found")
Exception: No Input found

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but it might be perhaps different issue. I had connected the placeholder node to a dot and it still is having the same Traceback..
image

@jakubjezek001
Copy link
Member

Closing as it is replaced by #3838

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants